package com.jn.book.repository;

import com.jn.book.entity.Books;
import com.jn.book.entity.CatalogEntity;
import com.jn.book.http.GlobalRetrofitClient;
import com.jn.book.service.BookService;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class BooksRepository {
    private BookService mService;

    public BooksRepository() {
        mService = GlobalRetrofitClient.getInstance().create(BookService.class);
    }

    public Observable<Books> getBooks(String key, String catalog_id) {
        return mService.getBooks(key, catalog_id, 0, 30)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}